package org.calzz.example.math;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller("simple")
public class SimpleMathController {

	@RequestMapping("average")
	public double avg(	@RequestParam(value="first", required=true) int a,
						@RequestParam(value="second") int b) {
		return (a + b) / 2;
	}

	public int sum(int[] ints) {
		int sum = 0;
		for(int a : ints) {
			sum += a;
		}
		return sum;
	}

}
